﻿// //  ********************************************************************************
// //  Copyright (C) 2016 Sebastian Kenter. All rights reserved.
// // 
// //  Name    : PhotonServerProject | PhotonServerFramework | IServerPeerFactory.cs
// //  Created : 2016 - 03 - 21 10:03
// //  Modified: 2016 - 04 - 18 09:38
// //  ********************************************************************************

using ExitGames.Logging;
using PhotonServerFramework.Interfaces.Configuration;

namespace PhotonServerFramework.Interfaces.Server
{
    /// <summary>
    ///     Interface for the server peere factory (creates real server peers from the initRequest)
    /// </summary>
    public interface IServerPeerFactory
    {
        /// <summary>
        ///     Logger instance
        /// </summary>
        ILogger Logger { get; }

        /// <summary>
        ///     Creates a real server peer from the configuration provided
        /// </summary>
        /// <typeparam name="T">Base type of the peer to be created (<see cref="P:Photon.SocketServer.ServerPeerBase" />)</typeparam>
        /// <param name="configuration">
        ///     The configuration of that peer (
        ///     <see cref="S:PhotonServerFramework.Implementation.Configuration.PeerConfiguration" />)
        /// </param>
        /// <returns>Implementation of IServerPeer or null in case of an error</returns>
        T CreateServerPeer<T>(IPeerConfiguration configuration) where T : class;
    }
}
